/*(C) Copyright

    This file is part of GastosMovil.
    
    GastosMovil is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GastosMovil is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GastosMovil.  If not, see <http://www.gnu.org/licenses/>.
    
    Autor: Antonio Cristóbal Álvarez Abellán -> acabellan@gmail.com
    
    */

package deeloco.android.gastos.Movil.plus;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

	public class ImageAdapter extends BaseAdapter {
	    private Context mContext;

	    public ImageAdapter(Context c) {
	        mContext = c;
	    }

	    public int getCount() {
	        return mThumbIds.length;
	    }

	    public Object getItem(int position) {
	        return null;
	    }

	    public long getItemId(int position) {
	        return 0;
	    }

	    // create a new ImageView for each item referenced by the Adapter
	    public View getView(int position, View convertView, ViewGroup parent) {
	        //ImageView imageView;
	        View vista;
	        if (convertView == null) {  // if it's not recycled, initialize some attributes
	        	LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
	        	//LayoutInflater li = getLayoutInflater();
	        	vista = inflater.inflate(R.layout.icono_texto, null);
	        	
	        	
	        	TextView tv = (TextView)vista.findViewById(R.id.icon_text);
                tv.setText(subtitulos[position]);
                ImageView iv = (ImageView)vista.findViewById(R.id.icon_image);
                iv.setImageResource(mThumbIds[position]);
                
	        } else {
	            vista = convertView;
	        }

	        return vista;
	    }

	    // references to our images
	    private Integer[] mThumbIds = {
	            R.drawable.listado, R.drawable.cost,
	            R.drawable.settings, R.drawable.alarm,
	            R.drawable.lightbulb, R.drawable.youtube
	    };
	    
	    private String[] subtitulos = {
	    		"Llamadas","Tarifas",
	    		"Ajustes","Alarmas",
	    		"Acerca De","Video Manuales"
	    };
	}
